﻿/*
Copyright (c) 2010 Lance Ward
This software is licensed under the MIT license, except where otherwise noted.
For complete license details, refer to license.txt
*/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using System.Drawing;
using System.Drawing.Drawing2D;

namespace ADNLib
{
    [Serializable]
    public class XFont
    {
        private string name = String.Empty; //font name
        private float size;
        private FontStyle style = FontStyle.Regular;

        public XFont() { }
        public XFont(string name, float size, FontStyle style)
        {
            this.name = name;
            this.size = size;
            this.style = style;
        }

        public XFont(string name, float size)
        {
            this.name = name;
            this.size = size;
        }

        [XmlAttribute]
        public string Name
        {
            get { return name; }
            set { name = value; }
        }

        [XmlAttribute]
        public float Size
        {
            get { return size; }
            set { size = value; }
        }

        [XmlAttribute]
        public FontStyle Style
        {
            get { return style; }
            set { style = value; }
        }

        public Font GetFont()
        {
            return new Font(name, size, style);
        }

        public FontFamily GetFamily()
        {
            return GetFont().FontFamily;
        }

        public void SetFont(Font f)
        {
            this.style = f.Style;
            this.size = f.Size;
            this.name = f.FontFamily.Name;
        }
    }
}
